const getCoins = async (id, anchor_id, room_id) => {
	return new Promise(async (resolve, reject) => {
		try {
			console.log('走到了getCoins');
			if (!tikTokCookie) return resolve();
			var config1 = {
				method: 'get',
				url: `https://webcast.us.tiktok.com/webcast/ranklist/online_audience/?aid=1988&anchor_id=${anchor_id}&app_language=zh-Hans&app_name=tiktok_web&browser_language=zh-CN&browser_name=Mozilla&browser_online=true&browser_platform=Win32&browser_version=5.0%20%28Windows%20NT%2010.0%3B%20Win64%3B%20x64%29%20AppleWebKit%2F537.36%20%28KHTML%2C%20like%20Gecko%29%20tiktok_live_user_caiji%2F1.0.2%20Chrome%2F134.0.6998.44%20Electron%2F35.0.1%20Safari%2F537.36&channel=tiktok_web&cookie_enabled=true&data_collection_enabled=true&device_id=7482780645112153607&device_platform=web_pc&focus_state=true&from_page=user&history_len=2&is_fullscreen=false&is_page_visible=true&os=windows&priority_region=CN&referer=&region=JP&room_id=${room_id}&screen_height=1440&screen_width=3440&tz_name=Asia%2FShanghai&user_is_login=true&webcast_language=zh-Hans`,
				headers: {
					priority: 'u=1, i',
					Cookie: tikTokCookie,
					'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36',
				},
				timeout: 10000,
			};
			const res = await axios(config1);
			const ranks = res.data.data?.ranks;
			let count = 0;
			if (ranks) {
				for (const rank of ranks) {
					count += rank.score;
				}
			}
			if (count < setting.minCoins) {
				await userDB.batchDelete([id]);
			} else {
				await userDB.batchUpdateById([id], { coins: String(count) });
			}
			log.info('获取金币成功', anchor_id, count);
			resolve();
		} catch (error) {
			log.error(`获取金币错误:${error}`);
			resolve();
		}
	});
};
